﻿#if StructureMap
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
//using StructureMap;

namespace PersonalAlbum.Controllers
{
    public class StructureMapControllerFactory : DefaultControllerFactory
    {

        protected override IController GetControllerInstance(Type controllerType)
        {            
            IController result;
            try
            {
                result= ObjectFactory.GetInstance(controllerType) as Controller;
                //  result = ObjectFactory.GetInstance(controllerType) as Controller;

            }
            catch (Exception)
            {
                throw new HttpException(404,"");
                //   System.Diagnostics.Debug.WriteLine(ObjectFactory.WhatDoIHave());
                throw;
            }
            return result;

        }
    }
}
#endif
